package com.example.nio.chat;

import java.io.*;
import java.net.Socket;

public class Client {
    private Socket socket;
    private int serverPort;
    private String serverIP;

    public Client(String serverIP, int serverPort) {
        this.serverIP = serverIP;
        this.serverPort = serverPort;
    }

    public void start() throws IOException {
        socket = new Socket(serverIP, serverPort);
        System.out.println("server connected");
    }

    public static void main(String[] args) throws IOException {
        Client client = new Client("localhost", 5000);
        client.start();

        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(client.socket.getInputStream()));
             BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(client.socket.getOutputStream()))) {
            bufferedWriter.write("Hello Server");
        } catch (IOException e) {

        }
    }
}
